<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>基础知识</title>
	<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"" rel="stylesheet">
	<link href="https://cdn.bootcdn.net/ajax/libs/animate.css/3.2.3/animate.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="../../static/css/public.css" />
	<style type="text/css">
		li{
			text-indent: 2em;
			padding: 5px 0;
		}
	</style>
</head>
<body>
	<!-- 回到顶部 -->
	<div class="topBtn">
		<a href="#top">
			<i class="fa fa-long-arrow-up"></i>
		</a>
	</div>
	<!--右边内容-->
	<div id="app" class="main animated fadeInRight">
		<div class="shadow">
			<div class="Table" v-cloak id="top">
				<div class="TableRow" v-for="(el,index) in list">
					<a class="RowLeft" :href="'#'+el.id"
					:title="el.name"
					>{{el.name}}</a>
					<span class="RowRight">{{el.explain}}</span>
				</div>
			</div>
			<div>
				<h4 id="link">设置属性</h4>
				<pre>
	var draw = SVG('svg1').size(300, 300);
	var circle = draw.circle(50);
	circle.fill('red').move(10, 10);
	//添加类
	circle.addClass('circle');
	//设置ID
	circle.id('circle');
	//SVG.get() 获取Element对象
	var circle2 = SVG.get('circle');				
				</pre>
			</div>
			<div>
				<h4 id="Defs">Defs</h4>
				<p>
				</p>
				<pre>
	
	draw.clear() 清空子节点
	//draw.each() 遍历子节点
	draw.each(function (i, children) {
	    console.info(i); //当前索引
	    console.info(children) //当前children引用
	    this.fill('green');
	});
	
	//draw.first()/draw.last() 获取第一个和最后一个
	draw.first().stroke({ width: 2 });
	draw.last().fill('green');
	//draw.get() //获取指定索引的节点对象
	var second = draw.get(1).stroke({ width: 2, color: 'yellow' })
	//draw.index() //获取指定对象的索引 defs元素
	var index = draw.index(second);
	console.info(index); //1 ,特别说明，第一个元素是
	//draw.has() //判断是否含有指定对象的元素
	console.info(draw.has(second)); //true				
				</pre>
			</div>
			<div>
				<h4 id="rect">绘制矩形</h4>
				<pre>
				</pre>
			</div>
			<div>
				<h4 id="ellipse">绘制椭圆形</h4>
				<pre>
				</pre>
			</div>
			<div>
				<h4 id="circle">绘制圆形</h4>
				<pre>
				</pre>
			</div>
			<div>
				<h4 id="polyline">绘制圆形</h4>
				<pre>
				</pre>
			</div>
			<div>
				<h4 id="polygon">绘制多边形</h4>
				<pre>
				</pre>
			</div>
			<div>
				<h4 id="path">绘制路径</h4>
				<pre>
				</pre>
			</div>
			<div>
				<h4 id="image">绘制图像</h4>
				<pre>
				</pre>
			</div>
			<div>
				<h4 id="text">绘制文本</h4>
				<pre>
				</pre>
			</div>
		</div>
	</div>
	<!--页面加载进度条-->
	<script src="https://cdn.bootcdn.net/ajax/libs/pace/0.5.0/pace.min.js"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.5.17/vue.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var app = new Vue({
			el: "#app",
			data: function() {
				return {
					list: [
						{ name: "设置属性",id: "link",explain: '设置类名、ID、属性'},
						{ name: "Defs",id: "Defs",explain: ''},
						// { name: "绘制矩形",id: "rect",explain: ''},
						// { name: "绘制椭圆形",id: "ellipse",explain: ''},
						// { name: "绘制圆形",id: "circle",explain: ''},
						// { name: "绘制线段",id: "polyline",explain: ''},
						// { name: "绘制多边形",id: "polygon",explain: ''},
						// { name: "绘制路径",id: "path",explain: ''},
						// { name: "绘制图像",id: "image",explain: ''},
						// { name: "绘制文本",id: "text",explain: ''},
					]
				}
			}
		})
	</script>
</body>

</html>